<?php
    /**
     * Created by JetBrains NetBeans.
     * User: yinyancai
     * Date: 13-3-14 下午4:44
     * To change this template use File | Settings | File Templates.
     */
    if (!defined('IN_MOBILE_API')) {
        exit('Access Denied');
    }
    include_once 'forum.php';
    class cloud_api {
        function common() { }

        function output() {
            //判断是否缺少参数
            if (empty($_GET['caid']) || empty($_GET['name']) || empty($_GET['content'])) {
                $variable = array(
                    'code' => 1001,
                    'messagestr' => lang('plugin/cloud', '1001'),
                );
                cloud_core::result(cloud_core::variable($variable));
            }
            $article=C::t('#cloud#cloud_article')->fetch_info($_GET['caid']);

            //更新产品
            $content =empty($_GET['content']) ? $article['content'] : $_GET['content'];
            $summarys=strip_tags($content);
            $data = array(
                'caid' => $_GET['caid'],
                'name' => empty($_GET['name']) ?$article['name'] : $_GET['name'],
                'content' => $content,
                'picurl' => empty($_GET['picurl']) ? $article['picurl'] : $_GET['picurl'],
                'summary' => strlen($summarys)<100 ? $summarys : self::msubstr($summarys,0,100),
                'lasttime' => TIMESTAMP,
                'status'=>($_GET['status']==null)?$article['status']:$_GET['status'], 
            );
            $result = C::t('#cloud#cloud_article')->update($_GET['caid'], $data);

            
            //正常返回
            $variable = array(
                'messagestr' => lang('plugin/cloud', '10014'),
            );
            cloud_core::result(cloud_core::variable($variable));
        }
    }

?>

